/**
 * 
 */
package com.taobao.wolfwolf.hibernate.dao.impl;

import java.util.List;


import com.taobao.wolfwolf.hibernate.dao.ProviderDao;
import com.taobao.wolfwolf.hibernate.pojo.Provider;

/**
 * @author Tux
 *
 * 创建时间: 2011-5-9 下午03:25:40
 */
@SuppressWarnings("unchecked")
public class ProviderDaoImpl extends BaseDaoImpl implements ProviderDao {

	public Provider findById(int id) throws Exception {
		return (Provider) getHibernateTemplate().get(Provider.class, id);
	}
	
	public List<Provider> findByName(String name) throws Exception {
		return super.findByProperty(Provider.class, "name", name);
	}

	public List<Provider> findAll() throws Exception {
		return getHibernateTemplate().find("from Provider");
	}

	public long getTotal() throws Exception {
		return super.countByCriteria(Provider.class);
	}

	public List<Provider> paging(int page, int limit) throws Exception {
		return super.findByCriteriaByPage(Provider.class, page, limit);
	}
}
